package org.example.demos.pattern.observer.animal;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

public enum AnimalFactory {
    LAOHU(new LaoHu()),
    HAITUN(new HaiTun()),
    HOUZI(new HouZi());

    private Animal animal;

    AnimalFactory(Animal animal){
        this.animal=animal;
    }


    public Animal getAnimal(){
        return animal;
    }

    public void setAnimal(){
        this.animal=animal;
    }


    public static List<Animal> getAnimals(){
        return Arrays.stream(AnimalFactory.values()).map(AnimalFactory::getAnimal).collect(Collectors.toList());
    }





}
